package com.education.welco.controller.app;


import com.education.common.core.BaseController;
import com.education.common.utils.ApiReturnObject;
import com.education.common.pojo.LCatalogMenu;
import com.education.welco.service.ILCatalogMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 备课目录 信息操作处理
 *
 * @author d
 * @date 2020-05-08
 */

@Api(tags = {"APP-平台课程--目录"})
@RestController
@RequestMapping("/app/lCatalogMenu")
public class AppLCatalogMenuController extends BaseController {

    @Autowired
    private ILCatalogMenuService ilCatalogMenuService;


    @ApiOperation(value = "平台课程--目录接口", httpMethod = "GET")
    @GetMapping("/selectMenu")
    public ApiReturnObject findByLMenu(){
        List<LCatalogMenu> catalogMenuList = ilCatalogMenuService.findByParentId(0);
        for (LCatalogMenu lCatalogMenu : catalogMenuList) {
            List<LCatalogMenu> catalogMenus = ilCatalogMenuService.findByParentId(lCatalogMenu.getId());
            lCatalogMenu.setTwoMenu(catalogMenus);
        }
        return new ApiReturnObject("200","查询成功",catalogMenuList.size(),catalogMenuList);
    }
}